// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
//     http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.

package log

import (
	"context"
	"gitee.com/go-wares/log/base"
)

// Debug
// send debug level log.
func Debug(text string) {
	if Manager.Config().DebugOn() {
		Manager.Log(nil, nil, base.LevelDebug, text)
	}
}

// Debugf
// send debug level log with standard format.
func Debugf(format string, args ...any) {
	if Manager.Config().DebugOn() {
		Manager.Log(nil, nil, base.LevelDebug, format, args...)
	}
}

// Debugfc
// send debug level log with context and standard format.
func Debugfc(ctx context.Context, format string, args ...any) {
	if Manager.Config().DebugOn() {
		Manager.Log(ctx, nil, base.LevelDebug, format, args...)
	}
}

// Info
// send info level log.
func Info(text string) {
	if Manager.Config().InfoOn() {
		Manager.Log(nil, nil, base.LevelInfo, text)
	}
}

// Infof
// send info level log with standard format.
func Infof(format string, args ...any) {
	if Manager.Config().InfoOn() {
		Manager.Log(nil, nil, base.LevelInfo, format, args...)
	}
}

// Infofc
// send info level log with context and standard format.
func Infofc(ctx context.Context, format string, args ...any) {
	if Manager.Config().InfoOn() {
		Manager.Log(ctx, nil, base.LevelInfo, format, args...)
	}
}

// Warn
// send warn level log.
func Warn(text string) {
	if Manager.Config().WarnOn() {
		Manager.Log(nil, nil, base.LevelWarn, text)
	}
}

// Warnf
// send warn level log with standard format.
func Warnf(format string, args ...any) {
	if Manager.Config().WarnOn() {
		Manager.Log(nil, nil, base.LevelWarn, format, args...)
	}
}

// Warnfc
// send warn level log with context and standard format.
func Warnfc(ctx context.Context, format string, args ...any) {
	if Manager.Config().WarnOn() {
		Manager.Log(ctx, nil, base.LevelWarn, format, args...)
	}
}

// Error
// send error level log.
func Error(text string) {
	if Manager.Config().ErrorOn() {
		Manager.Log(nil, nil, base.LevelError, text)
	}
}

// Errorf
// send error level log with standard format.
func Errorf(format string, args ...any) {
	if Manager.Config().ErrorOn() {
		Manager.Log(nil, nil, base.LevelError, format, args...)
	}
}

// Errorfc
// send error level log with context and standard format.
func Errorfc(ctx context.Context, format string, args ...any) {
	if Manager.Config().ErrorOn() {
		Manager.Log(ctx, nil, base.LevelError, format, args...)
	}
}

// Fatal
// send fatal level log.
func Fatal(text string) {
	if Manager.Config().FatalOn() {
		Manager.Log(nil, nil, base.LevelFatal, text)
	}
}

// Fatalf
// send fatal level log with standard format.
func Fatalf(format string, args ...any) {
	if Manager.Config().FatalOn() {
		Manager.Log(nil, nil, base.LevelFatal, format, args...)
	}
}

// Fatalfc
// send fatal level log with context and standard format.
func Fatalfc(ctx context.Context, format string, args ...any) {
	if Manager.Config().FatalOn() {
		Manager.Log(ctx, nil, base.LevelFatal, format, args...)
	}
}

// Panic
// send fatal level log.
func Panic(text string) {
	if Manager.Config().FatalOn() {
		Manager.Log(nil, nil, base.LevelFatal, text)
	}
}

// Panicf
// send fatal level log with standard format.
func Panicf(format string, args ...any) {
	if Manager.Config().FatalOn() {
		Manager.Log(nil, nil, base.LevelFatal, format, args...)
	}
}

// Panicfc
// send fatal level log with context and standard format.
func Panicfc(ctx context.Context, format string, args ...any) {
	if Manager.Config().FatalOn() {
		Manager.Log(ctx, nil, base.LevelFatal, format, args...)
	}
}
